<template>
    <el-form :model="form" label-width="auto" style="max-width: 200px">
    <el-form-item label="进货价">
      <el-input v-model="form.merchantTradePwd" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="tradeSubmit">更改</el-button>
    </el-form-item>
    </el-form>
    <el-form :model="form" label-width="auto" style="max-width: 200px">
    <el-form-item label="批发价">
      <el-input v-model="form.merchantBuyPwd" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="buySubmit">更改</el-button>
    </el-form-item>
    </el-form>
</template>

<script setup>
import {ref} from 'vue'
import {updateMerchantTrade,updateMerchantBuy,getMerchant} from '@/api/system/mini_user'
const form=ref({})

const getAll=()=>{
getMerchant().then(res=>{
    form.value=res.data
})
}
getAll()
const tradeSubmit=()=>{
    updateMerchantTrade(form.value.merchantTradePwd).then(res=>{
        form.value.merchantTradePwd=res.data
    })
} 

const buySubmit=()=>{
    updateMerchantBuy(form.value.merchantBuyPwd).then(res=>{
        form.value.merchantBuyPwd=res.data
    })
}

</script>